<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateHandleLoanExceptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('handle_loan_exceptions', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '处理放款异常表';
            $table->increments('id');
            $table->unsignedInteger('loan_apply_id')->index()->comment('关联loan_apply的id');
            $table->unsignedTinyInteger('loan_status_before')->comment('处理之前的状态');
            $table->unsignedTinyInteger('loan_status_after')->comment('处理之后的状态');
            $table->unsignedInteger('loan_apply_bank_card_id')->default(0)->comment('放款申请的银行卡id');
            $table->unsignedInteger('handle_bank_card_id')->default(0)->comment('处理后重新放款的银行卡id');
            $table->timestamp('handle_loan_time')->nullable()->comment('处理者填写的放款成功时间');
            $table->unsignedDecimal('loan_money',10,2)->default(0)->comment('处理者填写的放款金额');
            $table->unsignedInteger('handle_user_id')->comment('操作者id');
            $table->string('ip',100)->comment('操作者ip');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('handle_loan_exceptions');
    }
}
